/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package taskmanmiddleware;

import java.rmi.RemoteException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.rpc.ServiceException;
import replica_manager_client.*;

/**
 *
 * @author iMarshall
 */
public class Frontend
{
    private String endpoint;

    public Frontend()
    {
    }

    public Frontend(String endpoint)
    {
        this();
        this.endpoint = endpoint;
    }

    public boolean submitReplica(String resource)
    {
        ReplicaManagerAccessor rma =
            new ReplicaManagerAccessor(endpoint);

        boolean ret = false;

        try {
            ret = rma.submitReplica(resource);

        } catch (ServiceException ex) {
            ex.printStackTrace();

        } catch (RemoteException ex) {
            ex.printStackTrace();
            
        }

        return ret;
    }

    public boolean retrieveReplica()
    {
        ReplicaManagerAccessor rma =
            new ReplicaManagerAccessor(endpoint);

        boolean ret = false;

        try {
            ret = rma.retrieveReplica();

        } catch (ServiceException ex) {
            ex.printStackTrace();

        } catch (RemoteException ex) {
            ex.printStackTrace();

        }

        return ret;
    }
}
